package com.oocl.chat.util;

import java.io.ObjectOutputStream;
import java.util.Map;


public class MapOperate {
	public static void saveUser(String name,ObjectOutputStream oos){
		MaintainMap.getInstance().getMap().put(name, oos);
	}
	public static void removeUser(String name){
		MaintainMap.getInstance().getMap().remove(name);
	}
	//返回不包括自己的用户列表
	public static String getUserList(String username){
		StringBuffer userList = new StringBuffer();
		Map<String, ObjectOutputStream> map = MaintainMap.getInstance().getMap();
		boolean flag = true;
		for(String s: map.keySet()){
			if(!s.equals(username)){
				if(flag){
					userList.append(s);
					flag = false;
				}else{
					userList.append(","+s);
				}
			}
			
		}
		return userList.toString();
	}
}
